/**
 * 
 */
package com.goodedeeds.webapp.controller;


import com.youtills.core.admin.ILookup;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ravi
 *
 */

public class BaseDashboardAction extends BaseAuthAction {
	
	private static final String DASHBOARD_HEADER = JSP_ROOT + "/include/dashboard-header.jsp";
	private static final String VIEW = JSP_ROOT + "/include/base-dashboard.jsp";

	private static final String[] CSS_FILES = new String[]{
		CSS_ROOT + "/base-dashboard.css"
	};

	private static final String[] JS_FILES = new String[]{
		JS_ROOT + "/base-dashboard.js"
	};

	public BaseDashboardAction(){
		addJsFiles(JS_FILES);
		addCssFiles(CSS_FILES);
	}
	
	/* (non-Javadoc)
	 * @see com.depo.quiggle.view.controller.BaseAction#getBodyContent()
	 */
	@Override
	public final String getQuiggleHeaderInclude() {
		return DASHBOARD_HEADER;
	}

    @Override
    public String getQuiggleContent() {
        return VIEW;
    }

    public String getDashboardContent(){
		return null;
	}

    public IDashboardTab getCurrentTab(){
        return null;
    }

    private List<IDashboardTab> tabs;
    public final List<IDashboardTab> getTabs(){
        if(tabs == null){
            DashboardTab[] dashboardTabs = DashboardTab.values();
            ArrayList<IDashboardTab> _tabs = new ArrayList<IDashboardTab>(dashboardTabs.length);
            for(DashboardTab tab : dashboardTabs ){
                ILookup permissionType = tab.getPermissionType();
                if(tab != DashboardTab.NONE && (permissionType == null || isAuthorizationAllowed(permissionType))){
                    _tabs.add(tab);
                }
            }

            tabs = _tabs;
        }

        return tabs;
    }


    public ISubTab[] getSubTabs(){
        return null;
    }

    public ISubTab getCurrentSubTab(){
        return null;
    }

}
